<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:insert="~{import :: head}">
    <meta charset="UTF-8">
    <title th:text="${profileTitle}">个人资料页面</title>

    <!--引入自定义的import中的head 一些css，js的引入-->
   <!-- <div th:insert="~{import :: head}"></div>-->

</head>
<body>

<!--调用navigation.html中的nav 即我们自定义的导航栏-->
<div th:insert="navigation :: nav"></div>

<div class="container-fluid main" style="background-color: white">
    <div class="row">

        <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12" >
            <h2><span class="glyphicon glyphicon-list" aria-hidden="true" th:text="${profileTitle}">我的帖子/我的回复</span></h2>
            <hr>

            <!--如果是我的帖子，展示帖子页面-->
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" th:if="${profileAction == 'posts'}">
                <div th:each="post:${posts}">
                    <div class="media">
                        <div class="media-left">
                            <a href="#">
                                <img class="media-object img-circle"
                                     th:src="${session.user.avatarUrl}">
                            </a>
                        </div>
                        <div class="media-body">
                            <h4 class="media-heading">
                                <a th:text="${post.title}" th:href="@{'/post/'+ ${post.id}}">帖子标题</a>
                            </h4>
                            <span class="text-desc">
                                <span th:text="${post.commentCount}">0</span> 个回复 •
                                <span th:text="${post.viewCount}">0</span> 次浏览 •
                                最后一次访问时间：<span th:text="${#dates.format(post.gmtCreate,'yyyy-MM-dd HH:mm')}">yyyy-MM-dd HH:mm</span> •
                                <a th:href="@{'/publish/'+${post.id}}" class="community-menu"
                                   th:if="${session.user != null && session.user.id == post.authorId}">
                                    <span class="glyphicon glyphicon-pencil" aria-hidden="true">编辑</span>
                                </a>
                            </span>
                        </div>
                    </div>
                </div>
            </div>

            <!--如果是我的回复，展示我的回复页面-->
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" th:if="${profileAction == 'notice'}">
                <div class="media" th:each="notice : ${noticeDTOS}">
                    <div class="media-body">
                        <p class="media-heading">
                            <span th:text="${notice.senderName +' ' + notice.noticeTypeMsg + ' '}"></span>
                            <a th:href="@{'/notice/'+ ${notice.id}}"
                               th:text="${notice.postTitle}">
                            </a>
                            <span class="label label-danger" th:if="${notice.status == 0}">未读</span>
                            <span class="label label-success" th:if="${notice.status == 1}">已读</span>
                        </p>
                    </div>
                    通知发起时间：<span th:text="${#dates.format(notice.gmtCreate,'yyyy-MM-dd HH:mm')}">yyyy-MM-dd HH:mm</span>
                    <hr>
                </div>
            </div>


        </div>


        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
            <div class="list-group" style="margin-top: 15px">
                <a href="/profile/posts"
                   th:class="${profileAction == 'posts'}? 'active list-group-item' : 'list-group-item'">
                    我的帖子<span class="badge" th:text="${postCount}" >0</span></a>
                <a href="/profile/notice"
                   th:class="${profileAction == 'notice'}? 'active list-group-item' : 'list-group-item'">
                    我的通知<span class="badge" th:text="${noticeCount}">0</span></a>
            </div>
        </div>

    </div>
</div>

<!--帖子翻页按钮-->
<nav aria-label="Page navigation" th:if="${profileAction == 'posts'}">
    <ul class="pagination pagination-lg">
        <p>当前 <span th:text="${postPageInfo.pageNum}"></span> 页,总 <span th:text="${postPageInfo.pages}"></span> 页,共 <span th:text="${postPageInfo.total}"></span> 条记录</p>

        <li>
            <a th:href="@{posts(pageNum=1)}" aria-label="Previous">
                <span aria-hidden="true">首页</span>
            </a>
        </li>
        <li><a th:href="@{posts(pageNum=${postPageInfo.hasPreviousPage}?${postPageInfo.prePage}:1)}">上一页</a></li>
        <li><a th:href="@{posts(pageNum=${postPageInfo.hasNextPage}?${postPageInfo.nextPage}:${postPageInfo.pages})}">下一页</a></li>
        <li>
            <a th:href="@{posts(pageNum=${postPageInfo.pages})}" aria-label="Next">
                <span aria-hidden="true">尾页</span>
            </a>
        </li>
    </ul>
</nav>

<!--通知翻页按钮-->
<nav aria-label="Page navigation" th:if="${profileAction == 'notice'}">
    <ul class="pagination pagination-lg">
        <p>当前 <span th:text="${noticePageInfo.pageNum}"></span> 页,总 <span th:text="${noticePageInfo.pages}"></span> 页,共 <span th:text="${noticePageInfo.total}"></span> 条记录</p>

        <li>
            <a th:href="@{notice(pageNum=1)}" aria-label="Previous">
                <span aria-hidden="true">首页</span>
            </a>
        </li>
        <li><a th:href="@{notice(pageNum=${noticePageInfo.hasPreviousPage}?${noticePageInfo.prePage}:1)}">上一页</a></li>
        <li><a th:href="@{notice(pageNum=${noticePageInfo.hasNextPage}?${noticePageInfo.nextPage}:${noticePageInfo.pages})}">下一页</a></li>
        <li>
            <a th:href="@{notice(pageNum=${noticePageInfo.pages})}" aria-label="Next">
                <span aria-hidden="true">尾页</span>
            </a>
        </li>
    </ul>
</nav>

<!--引入我们自定义的footer中的foot 页脚文件 -->
<div th:insert="~{footer :: foot}"></div>

</body>
</html>